uniform float pointRadius;  // point size in world space
uniform float pointScale;   // scale to calculate size in pixels
uniform vec4 eyePos;

uniform vec3 halfVectorEye;
uniform vec2 invViewport;
uniform sampler2D shadowTex;
//uniform sampler3D noiseTex;
uniform sampler2D depthTex;

void main()
{
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

    // calculate window-space point size
    vec4 eyeSpacePos = gl_ModelViewMatrix * gl_Vertex;
    float dist = length(eyeSpacePos.xyz);
    gl_PointSize = pointRadius * (pointScale / dist);

    gl_TexCoord[0] = gl_MultiTexCoord0; // sprite texcoord
    gl_TexCoord[1] = eyeSpacePos;
 
    gl_FrontColor = gl_Color;
}